package fi.aalto.cse.T110_5150.P2PClient;

public class ByteArray extends NumberArray<Byte> {

	private static final long serialVersionUID = -1974526313814325909L;

	public ByteArray() {
	}
	
	public ByteArray(byte[] buf) {
		for (int i = 0; i < buf.length; ++i) {
			add(buf[i]);
		}
	}
	
	public byte[] toByteArray() {
		byte[] buf = new byte[size()];
		for (int i = 0; i < buf.length; ++i) {
			buf[i] = get(i);
		}
		return buf;
	}	

	@Override
	protected String numberFormat() {
		return "0x%02x";
	}	

	protected Byte decodeSingleNumber(String s) {
		return Byte.decode(s);
	}

}
